﻿using Jim.K3Cloud;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Jim.K3Cloud
{
    /// <summary>
    /// 服务接口
    /// </summary>
    [Sdk("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteOperation", "服务接口")]
    public class K3CloudExecuteOperationRequest : ISdkRequest<K3CloudExecuteOperationResponse>, IK3CloudCustomRequest
    {
        public string FormId { get; set; }
        public string OpNumber { get; set; }
        /// <summary>
        /// 创建者组织内码（非必录）
        /// </summary>
        public long CreateOrgId { get; set; }
        /// <summary>
        /// 单据编码集合，数组类型，格式：[No1,No2,...]（使用编码时必录）
        /// </summary>
        public string[] Numbers { get; set; }
        /// <summary>
        /// 单据内码集合，字符串类型，格式："Id1,Id2,..."（使用内码时必录）
        /// </summary>
        public string Ids { get; set; }
        /// <summary>
        /// 单据内码与分录内码对应关系的集合，字符串类型，格式：[{"Id":"Id1","EntryIds":"EntryId1,EntryId2,..."}] (使用分录状态转换时必录)
        /// </summary>
        public string PkEntryIds { get; set; }
        /// <summary>
        /// 是否启用网控，布尔类型，默认false（非必录）
        /// </summary>
        public bool NetworkCtrl { get; set; }
        /// <summary>
        /// 是否允许忽略交互，布尔类型，默认true（非必录）
        /// </summary>
        public bool IgnoreInterationFlag { get; set; } = true;

        public object QueryParams()
        {
            return new
            {
                FormId = FormId,
                OpNumber = OpNumber,
                Data = new
                {
                    CreateOrgId = CreateOrgId,
                    Numbers = Numbers,
                    Ids = Ids,
                    PkEntryIds = PkEntryIds,
                    NetworkCtrl = NetworkCtrl,
                    IgnoreInterationFlag = IgnoreInterationFlag
                }
            };
        }

        public void Validate()
        {
        }
    }
}

public class K3CloudExecuteOperationResponse : SdkResponse<List<ResponseStatusEntity>>
{
}
